package com.datasecops.scannerservices.enumerate;

/**
 * 数据库类型枚举类
 *
 * @param
 * @author SunLingzhi
 * @Description
 * @time 2022/8/12 16:33
 * @return
 */
public enum DBType {

    MYSQL("0"),

    ORACLE("1"),

    SQLSERVER("2"),

    HIVE("3"),

    POSTGRESQL("4"),

    MONGODB("5"),

    DM("6"),

    REDIS("7"),

    MARIADB("8"),

    DB2("9"),

    ELASTICSEARCH("10"),

    HBASE("11"),

    OPENGAUSS("12"),

    TIDB("13"),

    OCEANBASE("14"),

    OSCAR("15"),

    HOTDB("16"),

    OSS("17"),

    FILESERVER("18"),

    RDS_MYSQL("19"),
    RDS_POSTGRESQL("20"),
    RDS_SQLSERVER ("21"),
    RDS_MARIADB("22"),
    RDS_REDIS("23");


    private String key;

    public String getKey() {
        return key;
    }

    DBType(String key) {
        this.key = key;
    }

    public static DBType getDBType(String key) {
        for (DBType ele : values()) {
            if (ele.name().replace("_","-").equalsIgnoreCase(key)) {
                return ele;
            }
        }
        return null;
    }
}
